<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
          const arr = ['a', 'b', 'c']
      // 删除第二项
      const res1 = arr.splice(1,1)
      console.log(arr) // ['a', 'c']
      console.log(res1) // ['b']
      // 把第一项换成'red'
      const res2 = arr.splice(0,1,'red')
      console.log(arr) // ['red', 'c']
      console.log(res2) //['a']
      // 在第二位增加一项为'green'
      const res3 = arr.splice(1,0,'green')
      console.log(arr) // ['red','green', 'c']
      console.log(res3) //[]
    </script>
  </body>
</html>
